﻿using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using Autodesk.Revit.UI.Selection;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ZhuXingFamilys.Fileupload
{
    [Autodesk.Revit.Attributes.Transaction(TransactionMode.Manual)]
    public class GetThumbnail : IExternalCommand
    {
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            var uidoc = commandData.Application.ActiveUIDocument;
            var doc = uidoc.Document;

            var elemRef = uidoc.Selection.PickObject(ObjectType.Element);
            var elem = doc.GetElement(elemRef) as FamilyInstance;
            var previewImage = elem.Symbol.GetPreviewImage(new Size(100, 100));

            return Result.Succeeded;
        }

    }

}
